package cn.kgc.tangcco.tcbd1011.util;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

import org.apache.commons.beanutils.BeanUtils;

public class MyBeanUtils {
	public static <T>T populate(T entity,Map<String, String[]>param){
		try {
			BeanUtils.populate(entity, param);
		} catch (IllegalAccessException | InvocationTargetException e) {
			e.printStackTrace();
		}
		return entity;
	}
	
	public static <T>T populate(Class<T>clazz,Map<String, String[]>param){
		T entity=null;
		try {
			entity=clazz.newInstance();
			BeanUtils.populate(entity, param);
		} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
			e.printStackTrace();
		}
		return entity;
	}

}
